<template>
  <div class="app">
    <tree :treeAll="data"></tree>
    <!-- <tree v-for="v,k in data" :key='"for"+k' :label="v.label" :data='v.data'></tree> -->
    <canvas id="can" width="200" height="200"></canvas>
    
   <!-- <button @click="handleClick('A')">测试A</button>
    <button @click="handleClick('B')">测试B</button>
    <iframe
      :src="basic + newSrc"
      width="100%"
      height="500px"
      frameborder="0"
    ></iframe>
    <iframe
      src="https://www.baidu.com/?isIframe=1"
      width="100%"
      height="500px"
      frameborder="0"
    ></iframe> -->
  </div>
</template>

<script>
import { getList } from "./utls/request";
import tree from "./components/tree.vue";
export default {
  components: { tree },
  mounted() {
    getList({a:'ss'}).then(s=>{
      console.log(s);
    }).then(e=>{
      console.log(e);
    })
    this.$bus.$on("goTreeDetail", (data) => {
      console.log(data);
    });
    let formData = new FormData();
    formData.append("name", "我是name");
    formData.append("ages[]", [18, 19, 22, 20]);
    console.log(formData);
    console.log(formData.get("name"));
    console.log(formData.get("ages[]"));

    let date = new Date("2022-04-12T06:51:09.000+0000");
    console.log(date);

    let str = "2022-04-12T06:51:09.000+0000";
    console.log(Date.parse(str));
  },
  data() {
    return {
      data: [
        {
          label: "父节点1",
          data: [
            {
              label: "子节点1",
              data: [
                {
                  label: "子节点1-1",
                  data: [
                    {
                      label: "子节点1-1-1",
                      data: [],
                    },
                    {
                      label: "子节点1-1-2",
                      data: [],
                    },
                  ],
                },
                {
                  label: "子节点1-2",
                  data: [],
                },
              ],
            },
            {
              label: "子节点2",
              data: [],
            },
          ],
        },
        {
          label: "父节点2",
          data: [],
        },
      ],
      // basic:'http://localhost:3000',
      basic: "http://19.129.241.81",
      newSrc: "/monitor/run-monitor?isIframe=1&ticket=ZT1526897245336051713",
    };
  },
  methods: {
    handleClick(t) {
      if (t == "A") {
        this.newSrc =
          "/monitor/business?isIframe=1&ticket=ZT1526896176946159617";
      }
      if (t == "B") {
        this.newSrc =
          "/monitor/matterMonitor?isIframe=1&ticket=ZT1526896425961988097";
      }
    },
  },
};
</script>

<style scoped>
.san {
  width: 100px;
  height: 100px;
  border-radius: 100px 0px 0px 0px;
  background: red;
}
</style>